package com.kaifamiao.thread.d0928.pm;

import java.io.FileInputStream;
import java.io.OutputStream;
import java.net.Socket;

public class UploadClient {

    public static void main(String[] args) throws Exception{
        Socket client = new Socket("localhost", 9999);

        FileInputStream fis = new FileInputStream("C:\\Users\\10854\\Pictures\\cat.jpg");

        OutputStream outputStream = client.getOutputStream();

        fis.transferTo(outputStream);

        client.shutdownOutput();

        System.out.println("上传完毕");

        String str = new String(client.getInputStream().readAllBytes());
        System.out.println("结果是： " + str);
    }
}
